﻿using System;
using System.Collections.Generic;
using System.Text;

namespace UtilZ.Dotnet.Ex.Model
{
    /// <summary>
    /// 选中项改变事件
    /// </summary>
    public class CheckedArgs<T> : EventArgs
    {
        /// <summary>
        /// 数据源
        /// </summary>
        public T Source { get; private set; }

        /// <summary>
        /// 旧的的选中状态
        /// </summary>
        public bool OldChecked { get; private set; }

        /// <summary>
        /// 新的的选中状态
        /// </summary>
        public bool NewChecked { get; private set; }

        /// <summary>
        /// 是否更新选中状态[true:更新;false:不更新]
        /// </summary>
        public bool UpdateChecked { get; set; } = true;


        /// <summary>
        /// 构造函数初始化
        /// </summary>
        /// <param name="source">数据源</param>
        /// <param name="oldChecked">旧的的选中状态</param>
        /// <param name="newChecked">新的的选中状态</param>
        public CheckedArgs(T source, bool oldChecked, bool newChecked)
        {
            this.Source = source;
            this.OldChecked = oldChecked;
            this.NewChecked = newChecked;
        }
    }


    /// <summary>
    /// 选中项改变事件
    /// </summary>
    public class CheckedArgs : CheckedArgs<object>
    {
        /// <summary>
        /// 构造函数初始化
        /// </summary>
        /// <param name="source">数据源</param>
        /// <param name="oldChecked">旧的的选中状态</param>
        /// <param name="newChecked">新的的选中状态</param>
        public CheckedArgs(object source, bool oldChecked, bool newChecked)
            : base(source, oldChecked, newChecked)
        {
        }
    }
}
